package com.lyl.momanapp.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.liji.circleimageview.CircleImageView;
import com.lyl.momanapp.R;
import com.lyl.momanapp.bean.URL;
import com.lyl.momanapp.bean.User;
import com.lyl.momanapp.util.view.MyBaseActivity;

public class UserInfoDetailActivity extends MyBaseActivity {

    ImageView fanhui;
    CircleImageView iv_avatar;
    TextView tv_nick;
    TextView tv_id;
    TextView tv_sex;
    TextView tv_shengri;
    TextView tv_email;
    TextView tv_phone;
    TextView tv_city;
    TextView tv_qianming;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        setContentView(R.layout.activity_user_info_detail);
        super.onCreate(savedInstanceState);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.fanhui:
                finish();
                break;
        }
    }

    @Override
    public void initUI() {
        fanhui = (ImageView) findViewById(R.id.fanhui);
        tv_nick = (TextView) findViewById(R.id.tv_nick);
        iv_avatar = (CircleImageView) findViewById(R.id.iv_avatar);
        tv_id = (TextView) findViewById(R.id.tv_id);
        tv_sex = (TextView) findViewById(R.id.tv_sex);
        tv_shengri = (TextView) findViewById(R.id.tv_shengri);
        tv_email = (TextView) findViewById(R.id.tv_email);
        tv_phone = (TextView) findViewById(R.id.tv_phone);
        tv_city = (TextView) findViewById(R.id.tv_city);
        tv_qianming = (TextView) findViewById(R.id.tv_qianming);
    }

    @Override
    public void initData() {
        if (URL.Userlogin != null && URL.Userlogin.getResult() != null) {
            User.login.ResultBean bean = URL.Userlogin.getResult();

            // x.image().bind(mImg,URL.Userlogin.getResult().getAvatar());
            Glide.with(UserInfoDetailActivity.this).load(URL.Userlogin.getResult().getAvatar()).into(iv_avatar);

            tv_nick.setText(bean.getNick_name());
            tv_id.setText(bean.getUser_id() + "");
            tv_sex.setText("男");
            tv_shengri.setText("");
            tv_email.setText("");
            tv_phone.setText(bean.getStore_phone());
            tv_city.setText("");
            tv_qianming.setText("");

        } else {
            finish();
        }

    }

    @Override
    public void addListeners() {
        fanhui.setOnClickListener(this);
    }
}
